﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Globalization;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using emp.BLL;
using emp.ProcessFlow.SysManage;
using emp.Utility;

public partial class crm_campaign_ShowPhone : System.Web.UI.Page
{
    static int id;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.Params["id"] != null && Request.Params["id"].Equals("") == false)
            {
                try
                {
                    id = int.Parse(Request.Params["id"]);
                    Bind(id);
                }
                catch { }
            }
            

        }
    }

    private void Bind(int id)
    {
        int pageNum = 0;
        if (Request.Params["pageNum"] != null && Request.Params["pageNum"].Equals("") == false)
        {
            try
            {
                pageNum = int.Parse(Request.Params["pageNum"]);
            }
            catch { }
        }
        emp.BLL.Campaign campaign = new emp.BLL.Campaign();
        campaignList.PageIndex = pageNum;
        IList clist = campaign.getCAMPAIGN_SEND_INDIVIDUALS(id);
        this.campaignList.DataSource = clist;
        this.campaignList.DataBind();
        PageUtil.setPageCount(campaignList, clist);
    }

    protected void PageChanged(object sender, GridViewPageEventArgs e)
    {

        gview(e.NewPageIndex);

    }

    protected void query_Click(object sender, EventArgs e)
    {
        gview(0);
    }

    private void gview(int page)
    {

        campaignList.PageIndex = PageUtil.getGviewNewPage(campaignList, page);
        this.pageNum.Value = campaignList.PageIndex.ToString();
        emp.BLL.Campaign campaign = new emp.BLL.Campaign();
        IList clist = campaign.getCAMPAIGN_SEND_INDIVIDUALS(id,this.campaign_id.Text, this.campaign_name.Text);

        this.campaignList.DataSource = clist;
        this.campaignList.DataBind();

        PageUtil.setPageCount(campaignList, clist);

    }
    
    protected void campaignList_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
}